package baidu.bms.consumer;

import baidu.bms.DemoServiceConsumer;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author sunqiyuan
 * @Classname CallDemoService
 * @Description TODO
 * @Date 2020/10/14 10:19 上午
 * @Version V1.0
 */
@RestController("/")
public class HttpService {


    //  @DubboReference(version = "${demo.service.version}",services = "annotation-provider")
    // check 不在boot启动时检查，该接口是否启动， lazy 懒加载
    @DubboReference(version = "${demo.service.version}", check = false, lazy = true)
    private DemoServiceConsumer demoServiceConsumer;
    @Value("${dubbo.application.name}")
    private String serviceName;

    @GetMapping(path = "methodB")
    public String methodB(@RequestParam("name") String name) {
        String param = String.format(" %s ---> [%s : methodB: httpServer] ", name, serviceName);
        return param;
    }


}
